import logging
import HTMLTestRunner_cn
import yagmail,unittest
from Rk_2211A.rk_069.ctrip import Ctrip


def log():
    logging.basicConfig(level=logging.DEBUG,
                        filename='./login.log',
                        format='%(name)s %(message)s %(asctime)s %(thread)d',
                        filemode='a')

def baogao():
    request = HTMLTestRunner_cn.HTMLTestRunner(open('./baogao.html', 'wb'), title='测试报告')
    return request

def qq():
    email = yagmail.SMTP(user='3516922232@qq.com', password='sauvhzrimccccjbi',host='smtp.qq.com')
    email.send(to='3516922232@qq.com', subject='标题', contents=['login.log', 'baogao.html'])

if __name__ == '__main__':
    log()
    suite = unittest.TestSuite()
    suite.addTest(Ctrip('test_01'))
    baogao().run(suite)
    qq()